home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / allfiles / angry / main.dir / 00007_Script_scrollerz < prev    next >
Text File  |  1999-03-01  |  2KB  |  68 lines

  1. property pYLoc, pSpr, pNum
  2. property pYOffset, pActive
  3. property pOrigLoc
  4. property pLastLoc
  5.  
  6. global bgSpr
  7.  
  8. on new me, thisSpr
  9.   
  10.   set pSpr = thisSpr
  11.   set pNum = the memberNum of sprite(pSpr)
  12.   set pActive = TRUE
  13.   
  14.   set pYLoc = the locV of sprite(pSpr)
  15.   
  16.   set pYOffset = the locV of sprite(bgSpr) - the locV of sprite(pSpr)
  17.   
  18.   set pOrigLoc = the loc of sprite(bgSpr) - the loc of sprite(pSpr)
  19.   
  20.   puppetSprite pSpr, TRUE
  21.   
  22.   return me
  23. end
  24.  
  25.  
  26. on resetLoc me
  27.   set the loc of sprite(pSpr) = the loc of sprite(bgSpr) - pOrigLoc
  28.   set pYLoc = the locV of sprite(pSpr)
  29.   if pYLoc <> 1000 then set pActive = TRUE  
  30. end
  31.  
  32.  
  33. -- returning from other pages art will be in same loc as when user left.
  34. on ReturnLoc me
  35.   set the locV of sprite(pSpr) to 2000
  36.   if pActive = TRUE then set the locV of sprite(pSpr) = pYLoc
  37.   put pYLoc into pLastLoc
  38.   set the locV of sprite(pSpr) = pLastLoc
  39.   updatestage
  40.   
  41. end 
  42.  
  43.  
  44.  
  45.  
  46. on scroll me, thisDir, thisSpeed
  47.   if the locV of sprite(pSpr) = 1000 then
  48.     set pYloc = 1000
  49.     set pActive = FALSE
  50.   end if
  51.   
  52.   if pNum = name2Num("background") then -- background edge detection
  53.     set pYLoc = pYLoc + (thisSpeed * thisDir)
  54.     
  55.     if pYLoc + ((the height of member pNum)/2) < 479 then
  56.       set pYLoc = 479 - ((the height of member pNum)/2)
  57.     else if pYloc - ((the height of member pNum)/2) > 1 then
  58.       set pYLoc = 1 + ((the height of member pNum)/2)
  59.     end if
  60.   else -- not the background, place in relation to background loc
  61.     
  62.     if pActive then set pYloc = the locV of sprite(bgSpr) - pYOffset
  63.     
  64.   end if
  65.   if the locV of sprite(pSpr) <> pYLoc then set the locV of sprite(pSpr) = pYLoc
  66.   
  67. end
  68.